import generatedRoutes from 'virtual:generated-pages'

const FOLD_MENU = ['Others']

export default [
  {
    name: 'Dashboard',
    path: '/',
    redirect: '/pool'
  },
  {
    name: 'Client Pool',
    path: '/pool',
    component: () => import('@/layout/TopNavi.vue'),
    redirect: '/pool/client-pool',
    children: generatedRoutes.filter(route => route.path.match(/^\/pool\//)).sort((a, b) => a.meta.sort - b.meta.sort),
    meta: {
      inNavigation: true,
      icon: 'Pool'
    }
  },
  {
    path: '/phase-management',
    name: 'Phase Management',
    component: () => import('@/layout/TopNavi.vue'),
    children: generatedRoutes.filter(route => route.path.match(/^\/phase-management\//)),
    meta: {
      inNavigation: true,
      icon: 'PhaseManagement'
    }
  },
  {
    path: '/target-clients',
    name: 'Target Clients',
    component: () => import('@/layout/TopNavi.vue'),
    children: generatedRoutes.filter(route => route.path.match(/^\/target-clients\//)),
    meta: {
      inNavigation: true,
      icon: 'Target_Clients'
    }
  },
  {
    path: '/existing-clients',
    name: 'Existing Clients',
    component: () => import('@/layout/TopNavi.vue'),
    children: generatedRoutes.filter(route => route.path.match(/^\/existing-clients\//)),
    meta: {
      inNavigation: true,
      icon: 'Existing_Clients'
    }
  },
  /* {
    path: '/contract',
    name: 'Contract',
    component: () => import('@/layout/TopNavi.vue'),
    children: generatedRoutes.filter(route => route.path.match(/^\/contract\//)),
    meta: {
      inNavigation: true,
      icon: 'Contract'
    }
  }, */
  {
    path: '/personal-settings',
    name: 'Personal Settings',
    component: () => import('@/layout/TopNavi.vue'),
    children: generatedRoutes.filter(route => route.path.match(/^\/personal-settings\//)),
    meta: {
      inNavigation: true,
      icon: 'Others',
      foldInto: FOLD_MENU[0]
    }
  },
  {
    path: '/performance',
    name: 'Performance',
    component: () => import('@/layout/TopNavi.vue'),
    children: generatedRoutes.filter(route => route.path.match(/^\/performance\//)),
    meta: {
      inNavigation: true,
      icon: 'Others',
      foldInto: FOLD_MENU[0]
    }
  },
  {
    path: '/clients',
    name: 'Clients',
    component: () => import('@/layout/TopNavi.vue'),
    children: generatedRoutes.filter(route => route.path.match(/^\/clients\//)),
    meta: {
      inNavigation: true,
      icon: 'Others',
      foldInto: FOLD_MENU[0]
    }
  },
  {
    path: '/statistics',
    name: 'Statistics',
    redirect: '/statistics/invoice-number',
    component: () => import('@/layout/TopNavi.vue'),
    children: generatedRoutes
      .filter(route => route.path.match(/^\/statistics\//))
      .sort((a, b) => a.meta.sort - b.meta.sort),
    meta: {
      inNavigation: true,
      icon: 'Others',
      foldInto: FOLD_MENU[0]
    }
  }
  /* {
    path: '/commission-percentage',
    name: 'Commission Percentage',
    component: () => import('@/layout/TopNavi.vue'),
    children: generatedRoutes.filter(route => route.path.match(/^\/commission-percentage\//)),
    meta: {
      inNavigation: true,
      icon: 'Others',
      foldInto: FOLD_MENU[0]
    }
  },
  {
    path: '/clients-support',
    name: 'Clients Support',
    component: () => import('@/layout/TopNavi.vue'),
    children: generatedRoutes.filter(route => route.path.match(/^\/clients-support\//)),
    meta: {
      inNavigation: true,
      icon: 'Others',
      foldInto: FOLD_MENU[0]
    }
  } */
]
